gtk-demo: Put hte app menu in a separate file
authorMatthias Clasen <mclasen@redhat.com>
Sun, 28 Feb 2016 04:43:06 +0000 (23:43 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 28 Feb 2016 04:43:06 +0000 (23:43 -0500)
No need to cram it in the same file as the main window.

demos/gtk-demo/appmenu.ui [new file with mode: 0644]
demos/gtk-demo/demo.gresource.xml
demos/gtk-demo/main.c
demos/gtk-demo/main.ui

diff --git a/demos/gtk-demo/appmenu.ui b/demos/gtk-demo/appmenu.ui
new file mode 100644 (file)
index 0000000..d52693b
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.10 -->
+  <menu id="appmenu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">About</attribute>
+        <attribute name="action">app.about</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Quit</attribute>
+        <attribute name="action">app.quit</attribute>
+        <attribute name="accel">&lt;Primary&gt;q</attribute>
+      </item>
+    </section>
+  </menu>
+</interface>
index b1026498e515a1d21d04be26fd89284ebfaab449..ea8786363ff9ab8e2a11b06defffa3429ff497b6 100644 (file)
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/ui">
     <file preprocess="xml-stripblanks">main.ui</file>
+    <file preprocess="xml-stripblanks">appmenu.ui</file>
   </gresource>
   <gresource prefix="/application_demo">
     <file>application.c</file>
index 41202feefbcc97620f57c2ae40d2d1d82fc64a6d..3d21832e37284d11c08e9b60dfbaa7b9815501dc 100644 (file)
@@ -920,7 +920,7 @@ startup (GApplication *app)
   gchar *ids[] = { "appmenu", NULL };
 
   builder = gtk_builder_new ();
-  gtk_builder_add_objects_from_resource (builder, "/ui/main.ui", ids, NULL);
+  gtk_builder_add_objects_from_resource (builder, "/ui/appmenu.ui", ids, NULL);
 
   appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
 
index 4e06bbdbe9c5b8bb39b596c83d39c385592912e1..67a1ae11ec0fe1f5d15066c3756ce4a88e868044 100644 (file)
@@ -1,21 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.10 -->
-  <menu id="appmenu">
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">About</attribute>
-        <attribute name="action">app.about</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Quit</attribute>
-        <attribute name="action">app.quit</attribute>
-        <attribute name="accel">&lt;Primary&gt;q</attribute>
-      </item>
-    </section>
-  </menu>
   <object class="GtkTreeStore" id="treestore">
     <columns>
       <!-- column-name NAME -->